{% extends 'layout.html' %}
{% block content %}
<div class="card">
  <h2>{{ '编辑客户' if customer else '添加客户' }}</h2>
  <form method="post" class="form">
    {% if not customer %}
    <div class="form-group">
      <label>客户编号</label>
      <input type="text" name="customerID" required>
    </div>
    {% endif %}
    <div class="form-group">
      <label>姓名</label>
      <input type="text" name="customerName" value="{{ customer.customerName if customer }}" required>
    </div>
    <div class="form-group">
      <label>身份证号</label>
      <input type="text" name="PID" value="{{ customer.PID if customer }}" required>
    </div>
    <div class="form-group">
      <label>电话</label>
      <input type="text" name="telephone" value="{{ customer.telephone if customer }}" required>
    </div>
    <div class="form-group">
      <label>地址</label>
      <input type="text" name="address" value="{{ customer.address if customer }}" required>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn primary">提交</button>
      <a href="{{ url_for('customers') }}" class="btn">取消</a>
    </div>
  </form>
</div>
{% endblock %}
